home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-05-01 | 4.9 KB | 133 lines | [TEXT/MPS ] |
- % ---------------------------------------------------------------------------
- % Class MacUtilities
- %
- % The routines listed in Inside Macintosh chapter X:
- % The code has been converted from the file ToolInft.p
- % In this module you find the programmers interface to
- % General utility procedures. You will find the basic toolbox
- % callls in ToolboxUtilities.
- %
- % 890409/Boris Magnusson
- %
- % ---------------------------------------------------------------------------
- External class MacPoint="::Sinterfaces:MacPoint";
- External class MacRect="::Sinterfaces:MacRect";
- External class ToolboxUtilities="::Sinterfaces:toolboxUtilities";
- TOOLBOXUtilities class MacUtilities;
- begin
- ! General Utilities ;
-
- Integer procedure BitAnd(long1,long2); integer long1,long2;BitAnd:=TOOLBOXBitAnd(long1,long2);
- Integer procedure BitOr(long1,long2); integer long1,long2;BitOr:=TOOLBOXBitOr(long1,long2);
- Integer procedure BitXor(long1,long2); integer long1,long2;BitXor:=TOOLBOXBitXor(long1,long2);
- Integer procedure BitNot(long1); integer long1;BitNot:=TOOLBOXBitNot(long1);
- Integer procedure BitShift(long1,count); integer long1; short integer count;
- BitShift:=TOOLBOXBitShift(long1,count);
- Boolean procedure BitTst(bytePtr,bitNum); text bytePtr; integer bitNum;
- BitTst:=TOOLBOXBitTst(bytePtr,bitNum);
- procedure BitSet(bytePtr,bitNum); text bytePtr;integer bitNum;TOOLBOXBitSet(bytePtr,bitNum);
- procedure BitClr(bytePtr,bitNum); text bytePtr;integer bitNum;TOOLBOXBitClr(bytePtr,bitNum);
-
- % procedure TOOLBOXLongMul(a, b: LONGINT; VAR dst: Int64Bit);
-
- integer procedure FixMul(a, b);integer a,b;FixMul:=TOOLBOXFixMul(a, b);
- Integer procedure FixRatio(numer,denom); short integer numer,denom;
- FixRatio:=TOOLBOXFixRatio(numer,denom);
- short Integer procedure HiWord(x); integer x;HiWord:=TOOLBOXHiWord(x);
- short Integer procedure LoWord(x); integer x;LoWord:=TOOLBOXLoWord(x);
- short Integer procedure FixRound(x); integer x;FixRound:=TOOLBOXFixRound(x);
-
- % procedure TOOLBOXPackBits(VAR srcPtr, dstPtr: Ptr; srcBytes: INTEGER);
- % procedure TOOLBOXUnPackBits(VAR srcPtr, dstPtr: Ptr; dstBytes: INTEGER);
-
- Integer procedure SlopeFromAngle(angle); short integer angle;
- SlopeFromAngle:=TOOLBOXSlopeFromAngle(angle);
- short Integer procedure AngleFromSlope(slope); integer slope;
- AngleFromSlope:=TOOLBOXAngleFromSlope(slope);
-
- Integer procedure DeltaPoint(ptA, ptB);ref(MacPoint) ptA,ptB;
- DeltaPoint:=TOOLBOXDeltaPoint(ptA.v, ptB.v);
-
- % ??? NewString(theString: Str255): StringHandle;
- Integer procedure NewString(simText);text simText;
- begin
- text temp; temp:-text_string(simText);
- NewString:=TOOLBOXNewString(simText);
- end;
-
- % SetString(theString: StringHandle; strNew: Str255);
- procedure SetString(StringHandle,Str255);name Str255;
- integer StringHandle; text Str255;
- begin
- text temp;temp:-blanks(256);
- TOOLBOXSetString(StringHandle,Temp);
- Str255:-string_text(temp);
- end;
-
- Integer procedure GetString(stringID); short integer StringID;
- GetString:=TOOLBOXGetString(stringID);
-
- % External TOOLBOX procedure x="" is
- % procedure TOOLBOX GetIndString(VAR theString: Str255; strListID: INTEGER;
- % index: INTEGER);
- %
- % External TOOLBOX procedure x="$A9E0" is
- % Integer procedure TOOLBOX Munger(h: Handle; offset: LONGINT; ptr1: Ptr; len1: LONGINT;
- % ptr2: Ptr; len2: LONGINT): LONGINT;
- % INLINE $A9E0;
-
- Integer procedure GetIcon(iconID); short integer iconID; GetIcon:=TOOLBOXGetIcon(iconID);
-
- procedure PlotIcon(theRect,theIcon);ref(MacRect) theRect;integer theIcon;
- TOOLBOXPlotIcon(theRect.top,theIcon);
-
- Integer procedure GetCursor(cursorID); short integer cursorID;
- GetCursor:=TOOLBOXGetCursor(cursorID);
-
- % GetPattern(patID: INTEGER): PatHandle;
- Integer procedure GetPattern(patID); short integer patID;GetPattern:=TOOLBOXGetPattern(patID);
-
- % GetPicture(picID: INTEGER): PicHandle;
- Integer procedure GetPicture(picID); short integer picID;GetPicture:=TOOLBOXGetPicture(picID);
-
- % External TOOLBOX procedure x="" is
- % procedure TOOLBOX GetIndPattern(VAR thePat: Pattern; patListID: INTEGER;
- % index: INTEGER);
-
- procedure ShieldCursor(shield,offset);ref(MacRect) shield; ref(MacPoint) offset;
- TOOLBOXShieldCursor(shield.top,offset.v);
-
- % External TOOLBOX procedure x="" is
- % procedure TOOLBOXScreenRes(VAR scrnHRes, scrnVRes: INTEGER);
-
- % ===================================================================
- % Utilities addad to support Simula-calls to the toolbox
- % text_string
- % Routine to convert a SIMULA text to a Mac Pascal type str255
- %
- text procedure text_string(t); text t;
- begin
- text temp;
- temp:-blanks(256);
- temp.putchar(char(t.length));
- temp.sub(2,255):=t;
- text_string:-temp
- end;
-
- % string_text
- % Routine to convert a Mac Pascal type str255 to a SIMULA text.
- %
-
- text procedure string_text(t); text t;
- begin
- string_text:-t.sub(2,rank(t.sub(1,1).getchar));
- end;
-
- integer procedure ostype(thetext);text thetext;
- begin ostype:=rank(thetext.getchar)*16R1000000+
- rank(thetext.getchar)*16R10000+
- rank(thetext.getchar)*16R100+
- rank(thetext.getchar);
- end;
-
- END --- MAC Utilities --- ;